/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package byzantine;

import byzantine.controls.MenuControls;
import byzantine.controls.SelectedGeneralControls;
import byzantine.controls.SimulationSetupControls;
import byzantine.views.LegendView;
import byzantine.views.ReceivedMessageView;
import byzantine.controls.StepControls;
import byzantine.views.SentMessageView;
import byzantine.views.StatisticsView;
import byzantine.views.TreeView;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.geom.AffineTransform;
import javax.swing.Box;
import javax.swing.JFrame;
import javax.swing.JPanel;


/**
 *
 * @author Ryhan
 */
public class ByzantineApplication {

    JFrame masterWindow;
    ByzantineModel model;

    public ByzantineApplication() {

        model = new ByzantineModel();

        MenuControls menu = new MenuControls(model);
        SelectedGeneralControls sgControls = new SelectedGeneralControls(model);
        SimulationSetupControls ssControls = new SimulationSetupControls(model);
        StatisticsView sView = new StatisticsView(model);
        LegendView lView = new LegendView(model);
        SentMessageView seView = new SentMessageView(model);
        ReceivedMessageView reView = new ReceivedMessageView(model);
        StepControls rControls = new StepControls(model);
        TreeView tView = new TreeView(model);

        masterWindow = new JFrame("Byzantine Generals");
        masterWindow.setJMenuBar(menu.getMenuBar());
        // Toolkit t = Toolkit.getDefaultToolkit();
        // Dimension screenSize = t.getScreenSize();
        // masterWindow.setSize(new Dimension(screenSize.width, screenSize.height));

        Box box1 = Box.createVerticalBox();
        box1.add(sgControls);
        box1.add(ssControls);
        box1.add(sView);

        Box box2 = Box.createVerticalBox();
        box2.add(sView);
        box2.add(lView);
        box2.add(seView);
        box2.add(reView);

        Box box3 = Box.createVerticalBox();  
        box3.add(tView);
        box3.add(rControls);

        JPanel leftSide = new JPanel();
        leftSide.add(box1);

        JPanel center = new JPanel();
        center.add(box2);

        JPanel rightSide = new JPanel();
        rightSide.add(box3);

        masterWindow.getContentPane().add(leftSide, BorderLayout.WEST);
        masterWindow.getContentPane().add(center, BorderLayout.CENTER);
        masterWindow.getContentPane().add(rightSide, BorderLayout.EAST);

        masterWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        masterWindow.pack();
        masterWindow.setVisible(true);
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new ByzantineApplication();
            }
        });
    }
}
